package com.faithbj.process;

import java.io.Serializable;
import java.util.Map;

/**
 * User: xiongyuanwei
 * Date: 12-7-22
 * Time: 下午7:07
 */
public class ExcludedOwnerTaskModelFilter implements TaskModelFilter, Serializable {

    private String user;

    public ExcludedOwnerTaskModelFilter(String user) {
        this.user = user;
    }

    @Override
    public boolean accepts(TaskModel task) {
        return accepts(task.getContent());
    }

    @Override
    public boolean accepts(Map<String, Object> content) {
        String excludedForVerify = (String) content.get("excludedForVerify");
        if (excludedForVerify != null) {
            return !excludedForVerify.equals(user);
        } else {
            String excludedForCheck2 = (String) content.get("excludedForCheck2");
            return excludedForCheck2 == null || !excludedForCheck2.equals(user);
        }
    }
}
